#!/bin/bash

SCRIPT_DIR=$(cd $(dirname $0); pwd)

PROGRAM_NAME="dev-assistant-backend"

cd $SCRIPT_DIR

PROGRAM_PATH=$SCRIPT_DIR/$PROGRAM_NAME

PIDS=$(ps -ef | grep $PROGRAM_NAME | grep -v grep | awk '{print $2}')
echo "PIDS: $PIDS"

if [ -z "$PIDS" ]; then
    echo "$PROGRAM_NAME is not running"
    exit 1
fi

for PID in $PIDS; do
    kill -9 $PID
done

echo "stop $PROGRAM_NAME success"

exit 0;

